package cn.qyd.list;

import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author 邱运铎
 * @date 2024-03-13 10:44
 */
public class ArrayListDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("邱运铎");
        list.addAll(Lists.newArrayList("1","2","3"));
        list.forEach(System.out::println);
        for (int i=0, n=list.size(); i < n; i++ )
            System.out.println(list.get(i) + "-------");
        list.add(null);
        list.add(null);
        list.add("Java");
        for (Iterator i = list.iterator(); i.hasNext(); ) {
            System.out.println(i.next() + "+++++++");
        }
        list.remove(null);
        for (Iterator i = list.iterator(); i.hasNext(); ) {
            System.out.println(i.next() + "+++++++");
        }
    }
}
